package org.amphiprion.descentv2assistant.adapter;

import java.util.List;

import org.amphiprion.descentv2assistant.entity.Hero;
import org.amphiprion.descentv2assistant.util.SectionMap;

import android.content.Context;
import android.widget.SectionIndexer;

public class HeroIndexer implements SectionIndexer {
	private SectionMap<String, Hero> mSectionMap = new SectionMap<String, Hero>();

	public HeroIndexer(Context paramContext, List<Hero> paramArrayList) {
		for (int i = 0; i < paramArrayList.size(); i++) {
			Hero hero = paramArrayList.get(i);

			String sectionTitle = hero.getArchetype().getName();

			this.mSectionMap.add(sectionTitle, hero);
		}
	}

	public int getEpisodesForSeason(int paramInt) {
		return this.mSectionMap.getCountForGroup(paramInt);
	}

	@Override
	public int getPositionForSection(int paramInt) {
		return this.mSectionMap.getFirstIndexInSection(paramInt);
	}

	@Override
	public int getSectionForPosition(int paramInt) {
		return this.mSectionMap.getSectionFromIndex(paramInt);
	}

	@Override
	public Object[] getSections() {
		return this.mSectionMap.getSections();
	}
}